//
//  LKWorkCustomerDetailViewController.m
//  YLHelper
//
//  Created by she1323 on 2018/5/7.
//  Copyright © 2018年 she1323. All rights reserved.
//

#import "LKWorkCustomerDetailViewController.h"
#import "LKWorkOrderListDetailCell.h"
#import "LKWorkOrderListDetailPictureCell.h"
#import "LKWorkOrderDetailPOSPicCell.h"
#import "LKWorkOrderDetailOtherPicCell.h"
#import "LKBankFoldCell.h"
#import "LKWorkOrderDetailContractDetailCell.h"
#import "LKReservePhoneNumberCell.h"
@interface LKWorkCustomerDetailViewController ()<UITableViewDelegate,UITableViewDataSource>
@property(nonatomic,strong)LKBaseTableview *tableview;
@property(nonatomic,strong)NSArray *headerTitlsArray;
@property(nonatomic,strong)NSArray *headerIconsArray;
@property(nonatomic,strong)NSMutableArray *cellContentArray;
@property(nonatomic,assign)BOOL bankFlag;
@property(nonatomic,assign)BOOL secondbankFlag;
@property(nonatomic,strong)LKBankModel *bankModel;
@property(nonatomic,strong)NSMutableArray *bankCardsArray;
@property(nonatomic,strong)NSMutableArray *slectBankIndexArray;
@end

@implementation LKWorkCustomerDetailViewController
-(LKBaseTableview *)tableview{
    if (!_tableview) {
        _tableview = [LKBaseTableview setTableviewWithFrame:CGRectMake(0, NAVIGATION_BAR_HEIGHT, WIDTH , HEIGHT - NAVIGATION_BAR_HEIGHT) style:UITableViewStyleGrouped registercellClasss:@[@"LKWorkOrderListDetailCell",@"LKWorkOrderListDetailPictureCell",@"LKWorkOrderDetailOtherPicCell",@"LKBankFoldCell",@"LKWorkOrderDetailContractDetailCell",@"LKReservePhoneNumberCell"]];
      [self.view addSubview:_tableview];
        _tableview.delegate = self;
        _tableview.dataSource = self;
        _tableview.separatorStyle = UITableViewCellSeparatorStyleNone;
        _tableview.estimatedRowHeight = 0;
        _tableview.backgroundColor = [UIColor whiteColor];
    }
    return _tableview;
}
- (void)viewDidLoad {
    [super viewDidLoad];
    self.tableview.estimatedRowHeight = 0;
    [self getCurrentCustomerInformation];

    // Do any additional setup after loading the view.
}
-(void)setNavgationBackBtn{
    [super setNavgationBackBtn];
    self.navigationItem.title = _model.customerName;
}
-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
    return self.cellContentArray.count;
}
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    NSArray *contentsArra = self.cellContentArray[section];
    return contentsArra.count;
}
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    LKWorkOrderListDetailCell *cell = [tableView dequeueReusableCellWithIdentifier:@"LKWorkOrderListDetailCell"];
    cell.confirmImageView.hidden = YES;
    if ([self.model.identitfyCategory isEqual:@"1"]) {

        if ([self.model.isAuthenticated boolValue]) {
            switch (indexPath.section) {
                case 0:
                {
                    cell.arrowBtn.hidden = YES;
                    cell.lineView.hidden = YES;
                    if (indexPath.row == 0) {
                        cell.confirmImageView.hidden = NO;
                        if ([self.model.isAuthenticated boolValue]) {
                            cell.confirmImageView.image = [UIImage imageNamed:@"confirmPeople"];
                        }else{
                            cell.confirmImageView.image = [UIImage imageNamed:@"unconfirmPeople"];
                        }
                        cell.lineView.hidden = NO;
                    }
                    
                    if (indexPath.row == 10 || indexPath.row == 11) {
                        LKWorkOrderListDetailPictureCell *cell = [tableView dequeueReusableCellWithIdentifier:@"LKWorkOrderListDetailPictureCell"];
                        if (indexPath.row == 10) {
                            cell.pitureUrl = [NSString stringWithFormat:@"%@%@",ServerlUrl,self.model.identitfyPhotoUrl];
                            [cell.pictureImageView sd_setImageWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@%@",ServerlUrl,self.model.identitfyPhotoUrl]] placeholderImage:[UIImage imageNamed:@"pic"]];
                        }else{
                            cell.pitureUrl = [NSString stringWithFormat:@"%@%@",ServerlUrl,self.model.identitfyBackPhotoUrl];
                            [cell.pictureImageView sd_setImageWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@%@",ServerlUrl,self.model.identitfyBackPhotoUrl]] placeholderImage:[UIImage imageNamed:@"pic"]];
                        }
                        cell.titleLabel.text = self.cellContentArray[indexPath.section][indexPath.row];
                        return cell;
                    }
                    cell.titileLabel.text = self.cellContentArray[indexPath.section][indexPath.row];
                    return cell;
                }
                    break;
                    
                case 1:
                {
                    if ([self.slectBankIndexArray containsObject:indexPath]) {
                        LKBankFoldCell *bankcell = [tableView dequeueReusableCellWithIdentifier:@"LKBankFoldCell"];
                        bankcell.isIdentCatogry = YES;
                        LKBankModel *bankModel = self.cellContentArray[indexPath.section][indexPath.row];
                        bankcell.bankModel = bankModel;
                        bankcell.confirmBankCardImageView.hidden = NO;
                        if ([bankModel.isAuthenticated boolValue]) {
                            cell.confirmImageView.image = [UIImage imageNamed:@"confirmBankCard"];
                        }else{
                            cell.confirmImageView.image = [UIImage imageNamed:@"unconfirmBankCard"];
                        }
                        return bankcell;
                    }else{
                        LKBankModel *bankModel = self.cellContentArray[indexPath.section][indexPath.row];
                        cell.confirmImageView.hidden = NO;
                        if ([bankModel.isAuthenticated boolValue]) {
                            cell.confirmImageView.image = [UIImage imageNamed:@"confirmBankCard"];
                        }else{
                            cell.confirmImageView.image = [UIImage imageNamed:@"unconfirmBankCard"];
                        }
                        
                        cell.titileLabel.text = [NSString stringWithFormat:@"银行账户卡号：%@",bankModel.accountCode];
                        return cell;
                    }
                    
                    
                }
                    break;
                case 2:
                {
                    LKReservePhoneNumberCell *reservcell = [tableView dequeueReusableCellWithIdentifier:@"LKReservePhoneNumberCell"];
                    reservcell.visitPhoneTf.borderStyle = UITextBorderStyleNone;
                    reservcell.visitPhoneTf.text = self.model.defaultTel;
                    return reservcell;
                    
                }
                    break;
                case 3:
                {
                    cell.arrowBtn.hidden = YES;
                    cell.lineView.hidden = YES;
                    if (indexPath.row == 0) {
                        cell.lineView.hidden = NO;
                    }
                    cell.titileLabel.text = self.cellContentArray[indexPath.section][indexPath.row];
                    return cell;
                }
                    break;
                case 4:
                {
                    LKWorkOrderDetailContractDetailCell *cell = [tableView dequeueReusableCellWithIdentifier:@"LKWorkOrderDetailContractDetailCell"];
                    cell.typeTitle = @"附件信息";
                    //            cell.orderModel = self.model;
                    cell.customerModel = self.model;
                    //            cell.arrorBtn.selected = YES;
                    cell.arrorBtn.hidden = YES;
                    //            LKWorkOrderDetailOtherPicCell *cell = [tableView dequeueReusableCellWithIdentifier:@"LKWorkOrderDetailOtherPicCell"];
                    //            cell.arrorBtn.hidden = YES;
                    //            cell.titleLabel.hidden = YES;
                    return cell;
                    
                }
                    break;
                    
                default:
                    break;
            }
        }else{
            switch (indexPath.section) {
                case 0:
                {
                    cell.arrowBtn.hidden = YES;
                    cell.lineView.hidden = YES;
                    if (indexPath.row == 0) {
                        cell.confirmImageView.hidden = NO;
                        if ([self.model.isAuthenticated boolValue]) {
                            cell.confirmImageView.image = [UIImage imageNamed:@"confirmPeople"];
                        }else{
                            cell.confirmImageView.image = [UIImage imageNamed:@"unconfirmPeople"];
                        }
                        cell.lineView.hidden = NO;
                    }
                    
                    if (indexPath.row == 10 || indexPath.row == 11) {
                        LKWorkOrderListDetailPictureCell *cell = [tableView dequeueReusableCellWithIdentifier:@"LKWorkOrderListDetailPictureCell"];
                        if (indexPath.row == 10) {
                            [cell.pictureImageView sd_setImageWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@%@",ServerlUrl,self.model.identitfyPhotoUrl]] placeholderImage:[UIImage imageNamed:@"pic"]];
                        }else{
                            [cell.pictureImageView sd_setImageWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@%@",ServerlUrl,self.model.identitfyBackPhotoUrl]] placeholderImage:[UIImage imageNamed:@"pic"]];
                        }
                        cell.titleLabel.text = self.cellContentArray[indexPath.section][indexPath.row];
                        return cell;
                    }
                    cell.titileLabel.text = self.cellContentArray[indexPath.section][indexPath.row];
                    return cell;
                }
                    break;
                    
                case 1:
                {
                    if ([self.slectBankIndexArray containsObject:indexPath]) {
                        LKBankFoldCell *bankcell = [tableView dequeueReusableCellWithIdentifier:@"LKBankFoldCell"];
                        LKBankModel *bankModel = self.cellContentArray[indexPath.section][indexPath.row];
                        bankcell.bankModel = bankModel;
                        bankcell.confirmBankCardImageView.hidden = NO;
                        if ([bankModel.isAuthenticated boolValue]) {
                            cell.confirmImageView.image = [UIImage imageNamed:@"confirmBankCard"];
                        }else{
                            cell.confirmImageView.image = [UIImage imageNamed:@"unconfirmBankCard"];
                        }
                        return bankcell;
                    }else{
                        LKBankModel *bankModel = self.cellContentArray[indexPath.section][indexPath.row];
                        cell.confirmImageView.hidden = NO;
                        if ([bankModel.isAuthenticated boolValue]) {
                            cell.confirmImageView.image = [UIImage imageNamed:@"confirmBankCard"];
                        }else{
                            cell.confirmImageView.image = [UIImage imageNamed:@"unconfirmBankCard"];
                        }
                        
                        cell.titileLabel.text = [NSString stringWithFormat:@"银行账户卡号：%@",bankModel.accountCode];
                        return cell;
                    }
                    
                }
                    break;
                case 2:
                {
                    cell.arrowBtn.hidden = YES;
                    cell.lineView.hidden = YES;
                    if (indexPath.row == 0) {
                        cell.lineView.hidden = NO;
                    }
                    cell.titileLabel.text = self.cellContentArray[indexPath.section][indexPath.row];
                    return cell;
                }
                    break;
                case 3:
                {
                    LKWorkOrderDetailContractDetailCell *cell = [tableView dequeueReusableCellWithIdentifier:@"LKWorkOrderDetailContractDetailCell"];
                    cell.typeTitle = @"附件信息";
                    //            cell.orderModel = self.model;
                    cell.customerModel = self.model;
                    //            cell.arrorBtn.selected = YES;
                    cell.arrorBtn.hidden = YES;
                    //            LKWorkOrderDetailOtherPicCell *cell = [tableView dequeueReusableCellWithIdentifier:@"LKWorkOrderDetailOtherPicCell"];
                    //            cell.arrorBtn.hidden = YES;
                    //            cell.titleLabel.hidden = YES;
                    
                    return cell;
                    
                }
                    break;
                    
                default:
                    break;
            }
            
        }


    }else{
        switch (indexPath.section) {
            case 0:
            {
                cell.arrowBtn.hidden = YES;
                cell.lineView.hidden = YES;
                if (indexPath.row == 0) {
                    cell.confirmImageView.hidden = NO;
                    if ([self.model.isAuthenticated boolValue]) {
                        cell.confirmImageView.image = [UIImage imageNamed:@"confirmPeople"];
                    }else{
                        cell.confirmImageView.image = [UIImage imageNamed:@"unconfirmPeople"];
                    }
                    cell.lineView.hidden = NO;
                }
                
                if (indexPath.row == 10 || indexPath.row == 11) {
                    LKWorkOrderListDetailPictureCell *cell = [tableView dequeueReusableCellWithIdentifier:@"LKWorkOrderListDetailPictureCell"];
                    if (indexPath.row == 10) {
                        cell.pitureUrl = [NSString stringWithFormat:@"%@%@",ServerlUrl,self.model.identitfyPhotoUrl];
                        [cell.pictureImageView sd_setImageWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@%@",ServerlUrl,self.model.identitfyPhotoUrl]] placeholderImage:[UIImage imageNamed:@"pic"]];
                    }else{
                        cell.pitureUrl = [NSString stringWithFormat:@"%@%@",ServerlUrl,self.model.identitfyBackPhotoUrl];
                        [cell.pictureImageView sd_setImageWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@%@",ServerlUrl,self.model.identitfyBackPhotoUrl]] placeholderImage:[UIImage imageNamed:@"pic"]];
                    }
                    cell.titleLabel.text = self.cellContentArray[indexPath.section][indexPath.row];
                    return cell;
                }
                cell.titileLabel.text = self.cellContentArray[indexPath.section][indexPath.row];
                return cell;
            }
                break;
                
            case 1:
            {
                if ([self.slectBankIndexArray containsObject:indexPath]) {
                    LKBankFoldCell *bankcell = [tableView dequeueReusableCellWithIdentifier:@"LKBankFoldCell"];
                    LKBankModel *bankModel = self.cellContentArray[indexPath.section][indexPath.row];
                    bankcell.bankModel = bankModel;
                    bankcell.confirmBankCardImageView.hidden = NO;
                    if ([bankModel.isAuthenticated boolValue]) {
                        cell.confirmImageView.image = [UIImage imageNamed:@"confirmBankCard"];
                    }else{
                        cell.confirmImageView.image = [UIImage imageNamed:@"unconfirmBankCard"];
                    }
                    return bankcell;
                }else{
                    LKBankModel *bankModel = self.cellContentArray[indexPath.section][indexPath.row];
                    cell.confirmImageView.hidden = NO;
                    if ([bankModel.isAuthenticated boolValue]) {
                        cell.confirmImageView.image = [UIImage imageNamed:@"confirmBankCard"];
                    }else{
                        cell.confirmImageView.image = [UIImage imageNamed:@"unconfirmBankCard"];
                    }

                    cell.titileLabel.text = [NSString stringWithFormat:@"银行账户卡号：%@",bankModel.accountCode];
                    return cell;
                }
                
            }
                break;
            case 2:
            {
                cell.arrowBtn.hidden = YES;
                cell.lineView.hidden = YES;
                if (indexPath.row == 0) {
                    cell.lineView.hidden = NO;
                }
                cell.titileLabel.text = self.cellContentArray[indexPath.section][indexPath.row];
                return cell;
            }
                break;
            case 3:
            {
                LKWorkOrderDetailContractDetailCell *cell = [tableView dequeueReusableCellWithIdentifier:@"LKWorkOrderDetailContractDetailCell"];
                cell.typeTitle = @"附件信息";
                //            cell.orderModel = self.model;
                cell.customerModel = self.model;
                //            cell.arrorBtn.selected = YES;
                cell.arrorBtn.hidden = YES;
                //            LKWorkOrderDetailOtherPicCell *cell = [tableView dequeueReusableCellWithIdentifier:@"LKWorkOrderDetailOtherPicCell"];
                //            cell.arrorBtn.hidden = YES;
                //            cell.titleLabel.hidden = YES;
                
                return cell;
                
            }
                break;
                
            default:
                break;
        }
    }

    return cell;
}
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    if ([self.model.identitfyCategory isEqual:@"1"]) {
        switch (indexPath.section) {
            case 0:
            {
                if (indexPath.row == 10 || indexPath.row == 11) {
                    return 90;
                }
                return 35;
            }
                break;
            case 1:
                
            {
                if ([self.slectBankIndexArray containsObject:indexPath]) {
                    return 240;
                }
                return 35;
            }
                break;
            case 2:
            {
                return 35;
            }
                break;
            case 3:
            {
                return 35;
            }
                break;
            case 4:
            {
                if (self.model.customerAttach.count  % 3 == 0) {
                    return 70 + ((WIDTH - 40)/3 * 65 / 95 * (self.model.customerAttach.count / 3)+(self.model.customerAttach.count / 3) * 10 );
                }
//                if (self.model.customerAttach.count % 3 == 0) {
//                    return 70 + ((WIDTH - 40)/3 * 65 / 95 * (self.model.customerAttach.count / 3)+(self.model.customerAttach.count / 3) * 10 );
//                }
                return 70 + ((WIDTH - 40)/3 * 65 / 95 * (self.model.customerAttach.count / 3 + 1)+(self.model.customerAttach.count / 3) * 10 );
            }
                break;
            default:
                break;
        }

    }else{
        switch (indexPath.section) {
            case 0:
            {
                if (indexPath.row == 10 || indexPath.row == 11) {
                    return 90;
                }
                return 35;
            }
                break;
            case 1:
                
            {
                if ([self.slectBankIndexArray containsObject:indexPath]) {
                    return 240;
                }
                return 35;
            }
                break;
            case 2:
            {
                return 35;
            }
                break;
            case 3:
            {
                //            return 140;
                if (self.model.customerAttach.count % 3 == 0) {
                    return 70 + ((WIDTH - 40)/3 * 65 / 95 * (self.model.customerAttach.count / 3)+(self.model.customerAttach.count / 3) * 10 );
                }
                return 70 + ((WIDTH - 40)/3 * 65 / 95 * (self.model.customerAttach.count / 3 + 1)+(self.model.customerAttach.count / 3) * 10 );
            }
                break;
            default:
                break;
        }

    }
    return 0;
}
-(UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section{
    //设置头视图
    UIView *headerView = [[UIView alloc] init];
    headerView.backgroundColor = cellHeaderBgColor;
    UIView *headerBottomView = [[UIView alloc] init];
    headerBottomView.backgroundColor = [UIColor whiteColor];
    [headerView addSubview:headerBottomView];
    [headerBottomView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.bottom.equalTo(headerView);
        make.height.mas_equalTo(37);
    }];
    UIImageView *iconImageView = [[UIImageView alloc] init];
    iconImageView.image = [UIImage imageNamed:self.headerIconsArray[section]];
    [headerBottomView addSubview:iconImageView];
    [iconImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(headerBottomView).offset(14);
        make.centerY.equalTo(headerBottomView);
    }];
    LKBaseLabel *label = [LKBaseLabel labelWithFrame:CGRectZero text:@"" textColor:COLOR_HEX(0x565D66) font:[UIFont systemFontOfSize:15] textAlignment:NSTextAlignmentLeft backgroundColor:[UIColor whiteColor]];
    label.text = self.headerTitlsArray[section];
    [headerBottomView addSubview:label];
    [label mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(iconImageView.mas_right).offset(8);
        make.centerY.equalTo(iconImageView);
    }];
    if (section == 0) {
        UIView *headerTopView = [[UIView alloc] init];
        headerTopView.backgroundColor = [UIColor whiteColor];
        [headerView addSubview:headerTopView];
        [headerTopView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.right.top.equalTo(headerView);
            make.height.mas_equalTo(44);
        }];
        LKBaseLabel *statuLabel = [LKBaseLabel labelWithFrame:CGRectZero text:@"" textColor:COLOR_HEX(0x0E8205) font:[UIFont systemFontOfSize:15] textAlignment:NSTextAlignmentCenter backgroundColor:[UIColor whiteColor]];
        [headerTopView addSubview:statuLabel];
        [statuLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerX.equalTo(headerTopView);
            make.top.equalTo(headerTopView).offset(5);
        }];
        
        LKBaseLabel *stLabel = [LKBaseLabel labelWithFrame:CGRectZero text:@"客户类型" textColor:COLOR_HEX(0x929292) font:[UIFont systemFontOfSize:10] textAlignment:NSTextAlignmentCenter backgroundColor:[UIColor whiteColor]];
        statuLabel.text = [NSString backTitleAccordingCustormerCategoryType:[_model.custormerCategory integerValue]];
        [headerTopView addSubview:stLabel];
        [stLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerX.equalTo(headerTopView);
            make.bottom.equalTo(headerTopView).offset(-5);
        }];
    }
    return headerView;
}
-(UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section{
    UIView *footerView = [[UIView alloc] init];
    footerView.backgroundColor = cellHeaderBgColor;
    return footerView;
}
-(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{
    return section == 0 ? 98:37;
}
-(CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section{
    return 16;
}
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    switch (indexPath.section) {
        case 0:
        {
            
        }
            break;
        case 1:
        {
            if ([self.slectBankIndexArray containsObject:indexPath]) {
                [self.slectBankIndexArray removeObject:indexPath];
            }else{
                [self.slectBankIndexArray addObject:indexPath];
            }
            [self.tableview reloadSection:indexPath.section withRowAnimation:UITableViewRowAnimationNone];
        }
            break;
        case 2:
        {

        }
            break;
        case 3:
        {

            
        }
            break;
        default:
            break;
    }
}
-(NSMutableArray *)cellContentArray{
    if (!_cellContentArray) {
        _cellContentArray = [[NSMutableArray alloc] init];
    }
    return _cellContentArray;
}
//-(NSArray *)headerTitlsArray{
//    if (!_headerTitlsArray) {
//        _headerTitlsArray = @[@"基本信息",@"银行信息",@"紧急联系人",@"附件信息"];
//    }
//    return _headerTitlsArray;
//}
//-(NSArray *)headerIconsArray{
//    if (!_headerIconsArray) {
//        _headerIconsArray = @[@"xieyixinxi",@"yinhangxinxi",@"customerHeaderIcon",@"fujian"];
//    }
//    return _headerIconsArray;
//}
/**
 获取当前用户的详细信息
 */
-(void)getCurrentCustomerInformation{
    [[LKNetDataManager defaultManager] sendRequestMethod:HTTPMethodPOST serverUrl:ServerlUrl apiPath:CustomerDetailUrl header:[LKUserInforTool header] parameters:@{@"customerCode":_model.customerCode} progress:^(NSProgress * _Nullable progress) {
        
    } success:^(BOOL isSuccess, id  _Nullable responseObject) {
        NSDictionary *dic = responseObject[@"result"];
        
        LKCustomerModel *model = [LKCustomerModel modelWithDictionary:dic];
        self.model = model;
        NSString *customerName = [NSString stringWithFormat:@"%@%@",@"客户名称：",_model.customerName];
        NSString *customerCode = [NSString stringWithFormat:@"%@%@",@"客户编号：",_model.customerCode];
        NSString *customerSex = [_model.customerGender  isEqual: @"0"] ?@"男":@"女";
        NSString *customerS = [NSString stringWithFormat:@"%@%@",@"性别：",customerSex];
        NSString *tel = [NSString stringWithFormat:@"%@%@",@"电话：",_model.tel];
        
        NSString *email = [NSString stringWithFormat:@"%@%@",@"邮箱：",[NSString judegeIsNullAndTransform:_model.email]];
        NSString *identCatory = [NSString stringWithFormat:@"%@%@",@"证件类型：",[NSString backTitleAccordingIdCatogaryType:[_model.identitfyCategory integerValue]]];
        NSString *sorce = [NSString stringWithFormat:@"%@%@",@"来源：",[NSString backTitleAccordingSorceType:[_model.source integerValue]]];
        
        NSString *owener = [NSString stringWithFormat:@"%@%@",@"所属人：",[LKUserInforTool account].name];
        NSString *identId = [NSString stringWithFormat:@"%@%@",@"证件号码：",_model.identityId];
        NSString *Address = [NSString stringWithFormat:@"%@%@",[NSString judegeIsNullAndTransform:_model.city],[NSString judegeIsNullAndTransform:_model.address]];
        NSString *addre = [NSString stringWithFormat:@"%@%@",@"通讯地址：",[NSString judegeIsNullAndTransform:Address]];
        
        NSString *emergencyName = [NSString stringWithFormat:@"%@%@",@"姓名：",_model.emergenceyName];
        NSString *emergencyTel = [NSString stringWithFormat:@"%@%@",@"电话：",_model.emergenceyTel];
        
        NSString *emergencyRelation = [NSString stringWithFormat:@"%@%@",@"关系：",[NSString backTitleAccordingRelationType:[_model.emergenceyRealtion integerValue]]];
        for (LKBankModel *bankModel in _model.bankCards) {
            [self.bankCardsArray addObject:bankModel];
        }
        
        NSString *bankCode = [NSString stringWithFormat:@"%@%@",@"银行账户卡号：",self.bankModel.accountCode];
        if ([_model.identitfyCategory isEqual:@"1"]) {
            if ([_model.isAuthenticated boolValue]) {
                [self.cellContentArray addObjectsFromArray:@[@[customerName,customerCode,customerS,identCatory,identId,email,addre,sorce,owener],self.bankCardsArray,@[@""],@[emergencyName,emergencyTel,emergencyRelation],@[@""]]];
                self.headerTitlsArray = @[@"基本信息",@"银行信息",@"默认回访手机号",@"紧急联系人",@"附件信息"];
                self.headerIconsArray = @[@"xieyixinxi",@"yinhangxinxi",@"defautVistiPhone",@"customerHeaderIcon",@"fujian"];
            }else{
                [self.cellContentArray addObjectsFromArray:@[@[customerName,customerCode,customerS,identCatory,identId,tel,email,addre,sorce,owener,@"证件附件正面：",@"证件附件反面："],self.bankCardsArray,@[emergencyName,emergencyTel,emergencyRelation],@[@""]]];
                self.headerTitlsArray = @[@"基本信息",@"银行信息",@"紧急联系人",@"附件信息"];
                self.headerIconsArray = @[@"xieyixinxi",@"yinhangxinxi",@"customerHeaderIcon",@"fujian"];
            }

        }else{
           [self.cellContentArray addObjectsFromArray:@[@[customerName,customerCode,customerS,identCatory,identId,tel,email,addre,sorce,owener,@"证件附件正面：",@"证件附件反面："],self.bankCardsArray,@[emergencyName,emergencyTel,emergencyRelation],@[@""]]];
            self.headerTitlsArray = @[@"基本信息",@"银行信息",@"紧急联系人",@"附件信息"];
            self.headerIconsArray = @[@"xieyixinxi",@"yinhangxinxi",@"customerHeaderIcon",@"fujian"];
        }

        [self.tableview reloadData];
    } failure:^(NSString * _Nullable errorMessage) {
        
    }];

}
-(NSMutableArray *)bankCardsArray{
    if (!_bankCardsArray) {
        _bankCardsArray = [[NSMutableArray alloc] init];
    }
    return _bankCardsArray;
}
-(NSMutableArray *)slectBankIndexArray{
    if (!_slectBankIndexArray) {
        _slectBankIndexArray = [[NSMutableArray alloc] init];
    }
    return _slectBankIndexArray;
}




//- (UIImageView *)getImageViewOfCellByIndexPath:(NSIndexPath *)indexPath {
//    UITableViewCell *cell = [self.tableview cellForRowAtIndexPath:indexPath];
//    if (!cell) return nil;
//    return [cell.contentView viewWithTag:tagOfImageOfCell];
//}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
